/*
 * @author: wizardc
 */

using UnityEngine;

namespace Dou.Utils
{
    /// <summary>
    /// 数学工具类
    /// </summary>
    public static class MathUtil
    {
        public static bool CheckEqual(float a, float b)
        {
            return Mathf.Approximately(a, b);
        }
        
        public static bool CheckEqual(Vector2 a, Vector2 b)
        {
            return CheckEqual(a.x, b.x) && CheckEqual(a.y, b.y);
        }
        
        public static bool CheckEqual(Vector3 a, Vector3 b)
        {
            return CheckEqual(a.x, b.x) && CheckEqual(a.y, b.y) && CheckEqual(a.z, b.z);
        }
        
        public static bool CheckEqual(Vector4 a, Vector4 b)
        {
            return CheckEqual(a.x, b.x) && CheckEqual(a.y, b.y) && CheckEqual(a.z, b.z) && CheckEqual(a.w, b.w);
        }
        
        public static bool CheckEqual(RectOffset a, RectOffset b)
        {
            return CheckEqual(a.top, b.top) && CheckEqual(a.bottom, b.bottom) && CheckEqual(a.left, b.left) && CheckEqual(a.right, b.right);
        }
    }
}
